feat(af02): add deterministic surface scanner - #59
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review Please review exact head |
|
Superseding this draft PR without changing branch history because the connected GitHub GraphQL |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== HEAD and requested commit =='
git rev-parse HEAD
git cat-file -t 2fbbae7055aa963878148aaf742c2c5e5b446ed0
git merge-base --is-ancestor c9051ec6a143ee477d471fe29225269db0da67d9 2fbbae7055aa963878148aaf742c2c5e5b446ed0 && echo 'canonical-base-is-ancestor=yes'
echo '== Changed paths: canonical base..candidate =='
git diff --name-status c9051ec6a143ee477d471fe29225269db0da67d9 2fbbae7055aa963878148aaf742c2c5e5b446ed0
echo '== Candidate commit summary =='
git show --no-patch --format=fuller 2fbbae7055aa963878148aaf742c2c5e5b446ed0
echo '== Relevant files =='
fd . tools/af02-verifier -t f 2>/dev/null | sort
fd 'Cargo\.toml|Cargo\.lock|surface-policy\.json' -t f . | sort
echo '== Scanner source outline =='
if [ -f tools/af02-verifier/src/surface.rs ]; then
ast-grep outline tools/af02-verifier/src/surface.rs --items all --view expanded
fi
echo '== CLI/library source outlines =='
for f in tools/af02-verifier/src/*.rs; do
[ -f "$f" ] || continue
ast-grep outline "$f" --items all --view expanded
doneLength of output: 28075 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Canonical predecessor ancestry =='
git merge-base --is-ancestor d280e614f17732a9038662a4d193a3c5f2b5fa42 2fbbae7055aa963878148aaf742c2c5e5b446ed0 && echo 'd280e61-is-ancestor=yes'
git merge-base d280e614f17732a9038662a4d193a3c5f2b5fa42 2fbbae7055aa963878148aaf742c2c5e5b446ed0
echo '== Dependency manifest and lockfile evidence =='
git diff d280e614f17732a9038662a4d193a3c5f2b5fa42..2fbbae7055aa963878148aaf742c2c5e5b446ed0 -- tools/af02-verifier/Cargo.toml tools/af02-verifier/Cargo.lock
echo '== Public CLI paths =='
sed -n '1,260p' tools/af02-verifier/src/main.rs
echo '== Scanner: policy parse, discovery, scan orchestration =='
sed -n '1,531p' tools/af02-verifier/src/surface.rs
echo '== Scanner: alias/glob and visitor ownership logic =='
sed -n '532,985p' tools/af02-verifier/src/surface.rs
echo '== Scanner: path validation and tests =='
sed -n '986,1280p' tools/af02-verifier/src/surface.rs
echo '== Added integration tests =='
sed -n '1,360p' crates/commandf-pkg/tests/af02_surface_scanner.rs
echo '== Policy lineage and evidence-related paths =='
python3 - <<'PY'
import json
p='specs/016-af-02-adversarial-test-strength/surface-policy.json'
with open(p, encoding='utf-8') as f:
d=json.load(f)
print(json.dumps({
'lineage': d.get('lineage'),
'source_roots': d.get('source_roots'),
'known_boundary_witnesses_count': len(d.get('known_boundary_witnesses', [])),
'finding_exclusions_count': len(d.get('finding_exclusions', [])),
}, indent=2, sort_keys=True))
PY
echo '== All changed content names and evidence-keyword diff hits =='
git diff --unified=1 d280e614f17732a9038662a4d193a3c5e5b446ed0..2fbbae7055aa963878148aaf742c2c5e5b446ed0 \
| rg -n -i -C2 'source.universe|finding|witness|evidence|surface.policy|t013|dependent'Length of output: 62121 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Exact scanner lines: import and ownership handling =='
nl -ba tools/af02-verifier/src/surface.rs | sed -n '532,925p'
echo '== Exact scanner lines: discovery and finding identities =='
nl -ba tools/af02-verifier/src/surface.rs | sed -n '159,275p'
echo '== Surface policy matcher shapes =='
python3 - <<'PY'
import json
p='specs/016-af-02-adversarial-test-strength/surface-policy.json'
with open(p, encoding='utf-8') as f:
d=json.load(f)
for m in d['matchers']:
print(json.dumps(m, sort_keys=True))
PY
echo '== Candidate changes relative to actual main merge parent =='
git diff --name-status HEAD^2 HEAD
git diff --unified=3 HEAD^2 HEAD -- \
specs/016-af-02-adversarial-test-strength/surface-policy.json \
specs/016-af-02-adversarial-test-strength \
tools/af02-verifier \
crates/commandf-pkg/tests/af02_surface_scanner.rs
echo '== Tracked Rust sources selected by the scanner predicate =='
git ls-files -z -- crates tools | python3 -c '
import sys
paths=[p.decode("utf-8") for p in sys.stdin.buffer.read().split(b"\0") if p]
selected=[]
for p in paths:
parts=p.split("/")
if (p.startswith("crates/") or p.startswith("tools/")) and p.endswith(".rs") and "src" in parts and parts.index("src")+1 < len(parts):
selected.append(p)
print("\n".join(sorted(selected)))
'
echo '== Tests that cover local imports, glob-plus-qualified constructor bindings, and finding duplicates =='
rg -n -C2 -i 'local.*use|use .*::\*|glob|duplicate finding|identity|config_builder|method' \
tools/af02-verifier/src/surface.rs crates/commandf-pkg/tests/af02_surface_scanner.rsLength of output: 2031 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Exact scanner lines: import and ownership handling =='
awk 'NR >= 532 && NR <= 925 { printf "%6d %s\n", NR, $0 }' tools/af02-verifier/src/surface.rs
echo '== Exact scanner lines: discovery and finding identities =='
awk 'NR >= 159 && NR <= 275 { printf "%6d %s\n", NR, $0 }' tools/af02-verifier/src/surface.rs
echo '== Surface policy matcher shapes =='
python3 - <<'PY'
import json
p='specs/016-af-02-adversarial-test-strength/surface-policy.json'
with open(p, encoding='utf-8') as f:
d=json.load(f)
for m in d['matchers']:
print(json.dumps(m, sort_keys=True))
PY
echo '== Candidate changes relative to actual main merge parent =='
git diff --name-status HEAD^2 HEAD
git diff --unified=3 HEAD^2 HEAD -- \
specs/016-af-02-adversarial-test-strength/surface-policy.json \
specs/016-af-02-adversarial-test-strength \
tools/af02-verifier \
crates/commandf-pkg/tests/af02_surface_scanner.rs
echo '== Tracked Rust sources selected by the scanner predicate =='
git ls-files -z -- crates tools | python3 -c '
import sys
paths=[p.decode("utf-8") for p in sys.stdin.buffer.read().split(b"\0") if p]
selected=[]
for p in paths:
parts=p.split("/")
if (p.startswith("crates/") or p.startswith("tools/")) and p.endswith(".rs") and "src" in parts and parts.index("src")+1 < len(parts):
selected.append(p)
print("\n".join(sorted(selected)))
'
echo '== Relevant test coverage =='
rg -n -C2 -i 'local.*use|use .*::\*|glob|duplicate finding|identity|config_builder|method' \
tools/af02-verifier/src/surface.rs crates/commandf-pkg/tests/af02_surface_scanner.rs || trueLength of output: 103417
I found one issue.
The review also confirmed these points from static inspection:
You are interacting with an AI system. |
AF-02 Stack A0 — T012 scanner infrastructure
Canonical predecessor:
This A0 infrastructure candidate implements T012 only. It does not alter
surface-policy.json, does not commit source-universe/finding evidence, and does not claim T013.T012 implementation
syn = 3.0.3withfullandvisit, matching the planning-frozensyn-af02-scanneridentity;tools/af02-verifier/src/surface.rsas the plannedSURFACE_SCANNER/SURFACE_POLICY_PARSERimplementation path;synand scan cfg-disabled/dead syntax without scanning comments or literal contents;usealiases deterministically and emit uncertain findings for relevant glob ambiguity;PATH_CALL,TYPE_CONSTRUCTOR,METHOD_CALL, andMACRO_TOKENmatching with exact identities;parse-surface-policyandscan-surfaceCLI entrypoints while leavingverify-prfail-closed.Temporal/lineage boundary
The canonical surface policy remains the earlier BOOTSTRAP policy. This candidate intentionally does not rebase that policy and does not carry dependent source-universe/finding evidence.
dependent_evidence_allowed_in_same_candidateremains false. Policy rebase and T013 evidence remain separately governed after scanner authority is canonical.Qualification
The previously qualified implementation head is retained exactly at
dc4b9a38861e7ff9d3e0b34e07a8a2a43da473e5; after retargeting to canonicalmain, all path-applicable checks must be re-read against this exact candidate/base relation before merge. No PASS claim is made from stale base evidence.